﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DinhNghiaCanDoiKeToan : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("Button1")]
        private Button _Button1;
        [AccessedThroughProperty("CmdAddRow")]
        private Button _CmdAddRow;
        [AccessedThroughProperty("CmdDelRow")]
        private Button _CmdDelRow;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsDinhNghiaCanDoiKeToan objCDKT;

        public Frm_DinhNghiaCanDoiKeToan()
        {
            base.Load += new EventHandler(this.Frm_DinhNghiaCanDoiKeToan_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objCDKT = new clsDinhNghiaCanDoiKeToan();
            this.InitializeComponent();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_DinhNghiaCanDoiKeToan_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.InitData();
                this.LoadData();
            }
        }

        public void InitData()
        {
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            Hashtable hashtable4 = new Hashtable();
            hashtable4.Add("TS", "T\x00e0i sản");
            hashtable4.Add("NV", "Nguồn vốn");
            vSlist.Cols[2].DataMap = hashtable4;
            Hashtable hashtable2 = new Hashtable();
            hashtable2.Add("0", "Thường");
            hashtable2.Add("1", "Đậm");
            hashtable2.Add("2", "Nghi\x00eang");
            hashtable2.Add("3", "Nghi\x00eang Đậm");
            vSlist.Cols[6].DataMap = hashtable2;
            Hashtable hashtable5 = new Hashtable();
            hashtable5.Add("NO", "Nợ");
            hashtable5.Add("CO", "C\x00f3");
            vSlist.Cols[8].DataMap = hashtable5;
            Hashtable hashtable3 = new Hashtable();
            hashtable3.Add("CK", "Số dư cuối kỳ");
            hashtable3.Add("TO", "Cộng");
            vSlist.Cols[7].DataMap = hashtable3;
            Hashtable hashtable = new Hashtable();
            hashtable.Add("0", "Tổng");
            hashtable.Add("1", "Chi tiết");
            hashtable.Add("2", "");
            vSlist.Cols[9].DataMap = hashtable;
            vSlist = null;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DinhNghiaCanDoiKeToan));
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.Button1 = new Button();
            this.CmdDelRow = new Button();
            this.CmdAddRow = new Button();
            this.VSlist.BeginInit();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            Point point = new Point(0, 0);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.Rows.MinSize = 20;
            Size size = new Size(0x3e2, 0x250);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x1f;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.Button1);
            this.Panel1.Controls.Add(this.CmdDelRow);
            this.Panel1.Controls.Add(this.CmdAddRow);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0x250);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x3e2, 0x1a);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x20;
            this.Button1.Image = (Image) manager.GetObject("Button1.Image");
            this.Button1.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x63, 1);
            this.Button1.Location = point;
            this.Button1.Name = "Button1";
            size = new Size(0x5d, 0x18);
            this.Button1.Size = size;
            this.Button1.TabIndex = 0x19;
            this.Button1.Text = "&1.Ch\x00e8n d\x00f2ng";
            this.Button1.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.Button1.UseVisualStyleBackColor = true;
            this.CmdDelRow.Image = (Image) manager.GetObject("CmdDelRow.Image");
            this.CmdDelRow.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xc2, 1);
            this.CmdDelRow.Location = point;
            this.CmdDelRow.Name = "CmdDelRow";
            size = new Size(90, 0x18);
            this.CmdDelRow.Size = size;
            this.CmdDelRow.TabIndex = 0x18;
            this.CmdDelRow.Text = "&2.X\x00f3a d\x00f2ng";
            this.CmdDelRow.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.CmdDelRow.UseVisualStyleBackColor = true;
            this.CmdAddRow.Image = (Image) manager.GetObject("CmdAddRow.Image");
            this.CmdAddRow.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(4, 1);
            this.CmdAddRow.Location = point;
            this.CmdAddRow.Name = "CmdAddRow";
            size = new Size(0x5d, 0x18);
            this.CmdAddRow.Size = size;
            this.CmdAddRow.TabIndex = 0x17;
            this.CmdAddRow.Text = "&1.Th\x00eam d\x00f2ng";
            this.CmdAddRow.TextImageRelation = TextImageRelation.ImageBeforeText;
            this.CmdAddRow.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x3e2, 0x26a);
            this.ClientSize = size;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.MinimizeBox = false;
            this.Name = "Frm_DinhNghiaCanDoiKeToan";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "DINH NGHIA BAO CAO CAN DOI TAI KHOAN";
            this.VSlist.EndInit();
            this.Panel1.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            DataTable list = (DataTable) this.objCDKT.GetList();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            int num2 = list.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                vSlist.AddItem("");
                vSlist[i + 1, 0] = RuntimeHelpers.GetObjectValue(list.Rows[i]["MaSo"]);
                vSlist[i + 1, 1] = RuntimeHelpers.GetObjectValue(list.Rows[i]["Stt"]);
                vSlist[i + 1, 2] = list.Rows[i]["Loai"].ToString().Trim();
                vSlist[i + 1, 3] = RuntimeHelpers.GetObjectValue(list.Rows[i]["DienGiai"]);
                vSlist[i + 1, 4] = RuntimeHelpers.GetObjectValue(list.Rows[i]["MaSo"]);
                vSlist[i + 1, 5] = RuntimeHelpers.GetObjectValue(list.Rows[i]["ThuyetMinh"]);
                vSlist[i + 1, 6] = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(list.Rows[i]["HienThi"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                vSlist[i + 1, 7] = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(list.Rows[i]["LoaiTinh"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                vSlist[i + 1, 8] = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(list.Rows[i]["Ve"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                vSlist[i + 1, 9] = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(list.Rows[i]["CachTinh"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                vSlist[i + 1, 10] = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(list.Rows[i]["GhiAm"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                vSlist[i + 1, 11] = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(list.Rows[i]["Nguon"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            }
            vSlist = null;
        }

        private void VSlist_AfterEdit(object sender, RowColEventArgs e)
        {
            clsDinhNghiaCanDoiKeToan objCDKT = this.objCDKT;
            objCDKT.Stt = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 1]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            objCDKT.Loai = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 2]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            objCDKT.DienGiai = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 3]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            objCDKT.MaSo = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 4]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            objCDKT.ThuyetMinh = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 5]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            objCDKT.HienThi = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 6]), 0, modGeneral.TypeOfValue.Nothing));
            objCDKT.LoaiTinh = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 7]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            if (objCDKT.LoaiTinh == "CK")
            {
                objCDKT.Ve = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 8]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                objCDKT.CachTinh = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 9]), 0, modGeneral.TypeOfValue.Nothing));
            }
            else
            {
                objCDKT.Ve = "";
                objCDKT.CachTinh = 2;
            }
            objCDKT.Nguon = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 11]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
            if (Conversion.Val(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 10])) != 0.0)
            {
                objCDKT.GhiAm = 1;
            }
            else
            {
                objCDKT.GhiAm = 0;
            }
            objCDKT.Save(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 0]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
            objCDKT = null;
        }

        private void VSlist_BeforeEdit(object sender, RowColEventArgs e)
        {
            switch (e.Col)
            {
                case 8:
                case 9:
                    if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[e.Row, 7]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "TO")
                    {
                        e.Cancel = true;
                    }
                    break;
            }
        }

        internal virtual Button Button1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Button1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Button1 = value;
            }
        }

        internal virtual Button CmdAddRow
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAddRow;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdAddRow = value;
            }
        }

        internal virtual Button CmdDelRow
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDelRow;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdDelRow = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RowColEventHandler handler = new RowColEventHandler(this.VSlist_BeforeEdit);
                RowColEventHandler handler2 = new RowColEventHandler(this.VSlist_AfterEdit);
                if (this._VSlist != null)
                {
                    this._VSlist.BeforeEdit -= handler;
                    this._VSlist.AfterEdit -= handler2;
                }
                this._VSlist = value;
                if (this._VSlist != null)
                {
                    this._VSlist.BeforeEdit += handler;
                    this._VSlist.AfterEdit += handler2;
                }
            }
        }
    }
}

